<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>任务组管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				},
				rules:{
					name:{
						remote: {
						    url: $("#ctx").val()+"/pro/taskGroup/getByName",     //后台处理程序
						    type: "post",               //数据发送方式
						    dataType: "json",           //接受数据格式   
						    data: {                     //要传递的数据
						        name: function() {
						            return $("#name").val();
						        },
						        id: function(){
						        	return $("#id").val();
						        },
						        projectId:function(){
						        	return $("#projectId").val();
						        }
						    }
						}
					}
				},
				messages:{
					name:{
						remote:"该任务组名称已存在！"
					}
				}
			});
		});
	</script>
</head>
<body>
	<form:form id="inputForm" modelAttribute="taskGroup" action="${ctx}/pro/taskGroup/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<input type="hidden" id="ctx" value="${ctx}"/>
		<input id="projectId" name="project.id" value="${taskGroup.project.id}" type="hidden"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">任务组名称：</label>
			<div class="controls">
				<input id="name" name="name" value="${taskGroup.name}" disabled="disabled" class="input-xlarge required"/>
			</div>
		</div>
		<%-- <div class="control-group">
			<label class="control-label">所属项目id：</label>
			<div class="controls">
				<form:input path="project.id" htmlEscape="false" maxlength="64" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div> --%>
		<div class="control-group">
			<label class="control-label">备注信息：</label>
			<div class="controls">
			<%-- <form:hidden path="name" htmlEscape="false" maxlength="255" class="input-xlarge"/> --%>
			</div>
		</div>
		<div>
				<textarea rows="2" cols="" value="${taskGroup.remarks}" disabled="disabled" maxlength="1000" class="input-xxlarge "></textarea>
		</div>
	</form:form>
</body>
</html>